package cn.ys.org.service.impl;

import cn.ys.base.util.PageList;
import cn.ys.org.domain.Department;
import cn.ys.org.domain.SystemDictionary;
import cn.ys.org.mapper.SystemDictionaryMapper;
import cn.ys.org.query.DepartmentQuery;
import cn.ys.org.query.SystemDictionaryQuery;
import cn.ys.org.service.SystemDictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class SystemDictionaryServiceImpl implements SystemDictionaryService {
    
    @Autowired
    private SystemDictionaryMapper systemDictionaryMapper;
    
    // 查询全部
    @Override
    public List<SystemDictionary> findAll() {
        return systemDictionaryMapper.findAll();
    }

    @Override
    public SystemDictionary findById(Long id) {
        return systemDictionaryMapper.findById(id);
    }

    @Override
    public void add(SystemDictionary systemDictionary) {
        systemDictionaryMapper.add(systemDictionary);
    }

    @Override
    public void update(SystemDictionary systemDictionary) {
        systemDictionaryMapper.update(systemDictionary);
    }

    @Override
    public void delete(Long id) {
        systemDictionaryMapper.delete(id);
    }

    @Override
    public PageList<SystemDictionary> queryByPage(SystemDictionaryQuery query) {
        Integer totals = systemDictionaryMapper.queryByCount(query);
        if (null == totals || 0 == totals) {
            return new PageList<SystemDictionary>(0, new ArrayList<>());
        }
        List<SystemDictionary> rows = systemDictionaryMapper.queryByPage(query);
        return new PageList<>(totals, rows);
    }

    @Override
    public void piDeleteById(List<Long> ids) {
        systemDictionaryMapper.piDeleteById(ids);
    }

    @Override
    public List<SystemDictionary> deptTree() {
        return null;
    }
}
